<%@page import="java.util.List"%>
<%@page import="br.com.maternity.classes.dao.MedicoDAO"%>
<%@page import="br.com.maternity.classes.entity.Medico"%>
<%@page import="java.util.ArrayList"%>
<%@page import="br.com.maternity.componentes.grid.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:include page="../cabecalho.jsp"></jsp:include>
<div id="titulo">Relatorio de Medicos</div>
<div id="painel">

    <%
        ArrayList<PersonalGridColumn> cols = new ArrayList<PersonalGridColumn>();
        PersonalGridColumn c = new PersonalGridColumn("CRM", "getCrm", "");
        List<String> qsf = new ArrayList<String>();
        qsf.add("getCrm");
        c.setRedirectLink(request.getContextPath() + "/acoes/cadastroMedico.jsp?id=@");
        c.setQueryStringFields(qsf);
        cols.add(c);


        c = new PersonalGridColumn("CPF", "getCpf", "");
        c.setRedirectLink(request.getContextPath() + "/acoes/cadastroMedico.jsp?id=@");
        c.setQueryStringFields(qsf);
        c.setWidth(15);
        cols.add(c);

        c = new PersonalGridColumn("Nome", "getNome", "");
        c.setRedirectLink(request.getContextPath() + "/acoes/cadastroMedico.jsp?id=@");
        c.setQueryStringFields(qsf);
        c.setWidth(60);
        cols.add(c);

        c = new PersonalGridColumn("Telefone", "getTelefone", "");
        c.setRedirectLink(request.getContextPath() + "/acoes/cadastroMedico.jsp?id=@");
        c.setQueryStringFields(qsf);
        c.setWidth(15);
        cols.add(c);

        PersonalGridStyle rs = new PersonalGridStyle();

        MedicoDAO dao = new MedicoDAO();

        List<Medico> source = dao.selectAll();

        PersonalGrid g = new PersonalGrid("medico", "medico", new ArrayList<Object>(source), cols, rs);
    %>
    <%=g.render(null)%>
</div>
<br />
<a class="botao" href="../acoes/cadastroMedico.jsp">Novo médico</a>
<jsp:include page="../rodape.jsp"></jsp:include>